<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\External;
use App\Http\Controllers\ExternalJwtController;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/


Route::post('/getExternalToken', [ExternalJwtController::class, 'getAuthToken'])->withoutMiddleware(['external_jwt', 'external_system_unit']); //获取token,->withoutMiddleware([CheckExternalJwtHeaderToken::class])排除这个中间件，因为在路由服务中间件中，自动运用了这个中间件

//不需要token
Route::prefix('external')->group(function () {

    Route::post('/index/getResourceList', [External\IndexController::class, 'getResourceList']); // 获取资源数据
    Route::post('/index/getDownResourceId', [External\IndexController::class, 'getDownResourceId']); // 获取所有下架资源id

   // Route::post('/index/getResourceChapter', [External\IndexController::class, 'getResourceChapter']); // 电子书章节信息
    Route::post('/index/getChapterInfoBySrc', [External\IndexController::class, 'getChapterInfoBySrc']); // 根据电子书章节链接，获取电子书章节数据



    Route::post('/index/getResourceChapter', [External\IndexController::class, 'getResourceChapter']); // 获取资源章节信息（视频集数，音频集数）
    Route::post('/index/getAudioUrl', [External\IndexController::class, 'getAudioUrl']); // 根据音频资源id获取音频资源地址
    Route::post('/index/getVideoUrl', [External\IndexController::class, 'getVideoUrl']); // 根据视频资源id获取视频资源地址
    Route::post('/index/getEbookUrl', [External\IndexController::class, 'getEbookUrl']); // 根据电子书资源id获取电子书资源地址
});

//token必选
Route::middleware(['check.external.token'])->prefix('external')->group(function () {});

//token可选
Route::middleware(['check.may.external.token'])->prefix('external')->group(function () {});
